#pragma once

#include "ModelessDialog.h"

// OrderEntryDlg dialog

class OrderEntryDlg : public CModelessDialog, public L_Observer
{
	DECLARE_DYNAMIC(OrderEntryDlg)

public:
	OrderEntryDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~OrderEntryDlg();

	virtual BOOL Create(CWnd *pParentWnd = CWnd::FromHandle(L_GetMainWnd()));

// Dialog Data
	enum { IDD = IDD_ORDERENTRYDLG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()

protected:
// L_Observer
	virtual void HandleMessage(L_Message const *pMsg);

private:
	//controls
	CEdit m_SymbolEdit;
	CEdit m_BidEdit;
	CEdit m_AskEdit;
	CEdit m_SharesEdit;
	CEdit m_PriceEdit;
	CEdit m_MarketEdit;
	CEdit m_VisibleSharesEdit;
	CEdit m_Price2Edit;
	CEdit m_Market2Edit;
	CEdit m_InfoEdit;
	CComboBox m_OrderTypeCombo;
	CComboBox m_SideCombo;
	CComboBox m_TIFCombo;
	CComboBox m_HiddenCombo;
	CButton m_GoButton;
	CButton m_CancelButton;

	//control helpers
	void SummaryChanged();
	void L1Update();
	void DoGo();
	void DoCancel();
	void SetSymbol(const char *symbol);

	//data
	L_Account *account;
	L_Summary *summary;

	//options
	bool m_Linked;

	bool HasEnteredSymbol;
	long m_lCorrelationId;
	long m_lReferenceId;
	long m_lReferenceId2;

public:
	virtual BOOL OnInitDialog();
	afx_msg void OnOK();
	afx_msg void OnEnSetfocusBidEdit();
	afx_msg void OnEnSetfocusAskEdit();
	afx_msg void OnBnClickedGoButton();
	afx_msg void OnEnChangedSymbolEdit();
	afx_msg void OnBnClickedCancelOrderButton();
	afx_msg void OnFileLink();
};
